//
//  JZHorizontalBtnView.m
//  ERP
//
//  Created by QA on 16/4/5.
//  Copyright © 2016年 ShangHai HaoLei Software Technology Co., Ltd. All rights reserved.
//

#import "JZHorizontalBtnView.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "UIColorDispose.h"

@implementation JZHorizontalBtnView

-(id)initWithFrame:(CGRect)frame title:(NSString *)title subLable:(NSString *)subTitle imageStr:(NSString *)imageStr
{
    self = [super initWithFrame:frame];
    if (self) {
        NSInteger office = (SuperWidth == 375) ? 0 : 10;
        
        CGFloat yImageStart = frame.size.height/2 - 15;
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(15 - office/2, yImageStart, 30, 30)];
        [imageView sd_setImageWithURL:[NSURL URLWithString:imageStr] placeholderImage:[UIImage new]];
        imageView.contentMode = UIViewContentModeScaleAspectFit;
        [self addSubview:imageView];
        
        CGFloat yStart = frame.size.height/2 - 20;
        UILabel *titleLable = [[UILabel alloc] initWithFrame:CGRectMake(60 - office, yStart, frame.size.width - 60, 22)];
        titleLable.text = title;
        titleLable.textAlignment = NSTextAlignmentLeft;
        titleLable.font = [UIFont fontWithName:@"HelveticaNeue" size:16];
        titleLable.textColor = [UIColorDispose colorWithHexString:@"555555"];
        [self addSubview:titleLable];
        self.titleLable = titleLable;
        
        CGFloat y = titleLable.frame.size.height + titleLable.frame.origin.y;
        UILabel *subLable = [[UILabel alloc] initWithFrame:CGRectMake(60 - office, y, frame.size.width - 60, 22)];
        subLable.text = subTitle;
        subLable.textAlignment = NSTextAlignmentLeft;
        subLable.font = [UIFont systemFontOfSize:12];
        subLable.textColor = [UIColorDispose colorWithHexString:@"9faab2"];
        [self addSubview:subLable];
        self.subLable = subLable;
    }
    return self;
}

@end
